package com.dyw.Day33;

/**
 * @author Devil
 * @date 2022/04/11/0:20
 */
public class Demo01 {
    public int numberOfSteps(int num) {
        int n = 0;
        while(num !=0){
            if ((num %2 ==0)&&num>0){
                num /= 2;
                n++;
            }else if((num % 2 !=0)&&num>0){
                num -=1;
                n++;
            }
        }
        return n;
    }
}
